(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
	typeof define === 'function' && define.amd ? define(['exports'], factory) :
	(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.__userBehavior__ = {}));
})(this, (function (exports) { 'use strict';

	var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

	var check = function (it) {
	  return it && it.Math == Math && it;
	};

	// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
	var global$9 =
	  // eslint-disable-next-line es-x/no-global-this -- safe
	  check(typeof globalThis == 'object' && globalThis) ||
	  check(typeof window == 'object' && window) ||
	  // eslint-disable-next-line no-restricted-globals -- safe
	  check(typeof self == 'object' && self) ||
	  check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
	  // eslint-disable-next-line no-new-func -- fallback
	  (function () { return this; })() || Function('return this')();

	var fails$9 = function (exec) {
	  try {
	    return !!exec();
	  } catch (error) {
	    return true;
	  }
	};

	var fails$8 = fails$9;

	var functionBindNative = !fails$8(function () {
	  // eslint-disable-next-line es-x/no-function-prototype-bind -- safe
	  var test = (function () { /* empty */ }).bind();
	  // eslint-disable-next-line no-prototype-builtins -- safe
	  return typeof test != 'function' || test.hasOwnProperty('prototype');
	});

	var NATIVE_BIND$3 = functionBindNative;

	var FunctionPrototype$1 = Function.prototype;
	var apply$3 = FunctionPrototype$1.apply;
	var call$6 = FunctionPrototype$1.call;

	// eslint-disable-next-line es-x/no-reflect -- safe
	var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$3 ? call$6.bind(apply$3) : function () {
	  return call$6.apply(apply$3, arguments);
	});

	var NATIVE_BIND$2 = functionBindNative;

	var FunctionPrototype = Function.prototype;
	var bind$2 = FunctionPrototype.bind;
	var call$5 = FunctionPrototype.call;
	var uncurryThis$b = NATIVE_BIND$2 && bind$2.bind(call$5, call$5);

	var functionUncurryThis = NATIVE_BIND$2 ? function (fn) {
	  return fn && uncurryThis$b(fn);
	} : function (fn) {
	  return fn && function () {
	    return call$5.apply(fn, arguments);
	  };
	};

	// `IsCallable` abstract operation
	// https://tc39.es/ecma262/#sec-iscallable
	var isCallable$9 = function (argument) {
	  return typeof argument == 'function';
	};

	var objectGetOwnPropertyDescriptor = {};

	var fails$7 = fails$9;

	// Detect IE8's incomplete defineProperty implementation
	var descriptors = !fails$7(function () {
	  // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
	  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
	});

	var NATIVE_BIND$1 = functionBindNative;

	var call$4 = Function.prototype.call;

	var functionCall = NATIVE_BIND$1 ? call$4.bind(call$4) : function () {
	  return call$4.apply(call$4, arguments);
	};

	var objectPropertyIsEnumerable = {};

	var $propertyIsEnumerable = {}.propertyIsEnumerable;
	// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
	var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;

	// Nashorn ~ JDK8 bug
	var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);

	// `Object.prototype.propertyIsEnumerable` method implementation
	// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
	objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
	  var descriptor = getOwnPropertyDescriptor$1(this, V);
	  return !!descriptor && descriptor.enumerable;
	} : $propertyIsEnumerable;

	var createPropertyDescriptor$2 = function (bitmap, value) {
	  return {
	    enumerable: !(bitmap & 1),
	    configurable: !(bitmap & 2),
	    writable: !(bitmap & 4),
	    value: value
	  };
	};

	var uncurryThis$a = functionUncurryThis;

	var toString$4 = uncurryThis$a({}.toString);
	var stringSlice = uncurryThis$a(''.slice);

	var classofRaw$1 = function (it) {
	  return stringSlice(toString$4(it), 8, -1);
	};

	var uncurryThis$9 = functionUncurryThis;
	var fails$6 = fails$9;
	var classof$3 = classofRaw$1;

	var $Object$3 = Object;
	var split = uncurryThis$9(''.split);

	// fallback for non-array-like ES3 and non-enumerable old V8 strings
	var indexedObject = fails$6(function () {
	  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
	  // eslint-disable-next-line no-prototype-builtins -- safe
	  return !$Object$3('z').propertyIsEnumerable(0);
	}) ? function (it) {
	  return classof$3(it) == 'String' ? split(it, '') : $Object$3(it);
	} : $Object$3;

	var $TypeError$5 = TypeError;

	// `RequireObjectCoercible` abstract operation
	// https://tc39.es/ecma262/#sec-requireobjectcoercible
	var requireObjectCoercible$3 = function (it) {
	  if (it == undefined) throw $TypeError$5("Can't call method on " + it);
	  return it;
	};

	// toObject with fallback for non-array-like ES3 strings
	var IndexedObject = indexedObject;
	var requireObjectCoercible$2 = requireObjectCoercible$3;

	var toIndexedObject$1 = function (it) {
	  return IndexedObject(requireObjectCoercible$2(it));
	};

	var isCallable$8 = isCallable$9;

	var isObject$5 = function (it) {
	  return typeof it == 'object' ? it !== null : isCallable$8(it);
	};

	var path$4 = {};

	var path$3 = path$4;
	var global$8 = global$9;
	var isCallable$7 = isCallable$9;

	var aFunction = function (variable) {
	  return isCallable$7(variable) ? variable : undefined;
	};

	var getBuiltIn$3 = function (namespace, method) {
	  return arguments.length < 2 ? aFunction(path$3[namespace]) || aFunction(global$8[namespace])
	    : path$3[namespace] && path$3[namespace][method] || global$8[namespace] && global$8[namespace][method];
	};

	var uncurryThis$8 = functionUncurryThis;

	var objectIsPrototypeOf = uncurryThis$8({}.isPrototypeOf);

	var getBuiltIn$2 = getBuiltIn$3;

	var engineUserAgent = getBuiltIn$2('navigator', 'userAgent') || '';

	var global$7 = global$9;
	var userAgent = engineUserAgent;

	var process = global$7.process;
	var Deno = global$7.Deno;
	var versions = process && process.versions || Deno && Deno.version;
	var v8 = versions && versions.v8;
	var match, version;

	if (v8) {
	  match = v8.split('.');
	  // in old Chrome, versions of V8 isn't V8 = Chrome / 10
	  // but their correct versions are not interesting for us
	  version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
	}

	// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
	// so check `userAgent` even if `.v8` exists, but 0
	if (!version && userAgent) {
	  match = userAgent.match(/Edge\/(\d+)/);
	  if (!match || match[1] >= 74) {
	    match = userAgent.match(/Chrome\/(\d+)/);
	    if (match) version = +match[1];
	  }
	}

	var engineV8Version = version;

	/* eslint-disable es-x/no-symbol -- required for testing */

	var V8_VERSION = engineV8Version;
	var fails$5 = fails$9;

	// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
	var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$5(function () {
	  var symbol = Symbol();
	  // Chrome 38 Symbol has incorrect toString conversion
	  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
	  return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
	    // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
	    !Symbol.sham && V8_VERSION && V8_VERSION < 41;
	});

	/* eslint-disable es-x/no-symbol -- required for testing */

	var NATIVE_SYMBOL$2 = nativeSymbol;

	var useSymbolAsUid = NATIVE_SYMBOL$2
	  && !Symbol.sham
	  && typeof Symbol.iterator == 'symbol';

	var getBuiltIn$1 = getBuiltIn$3;
	var isCallable$6 = isCallable$9;
	var isPrototypeOf = objectIsPrototypeOf;
	var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;

	var $Object$2 = Object;

	var isSymbol$3 = USE_SYMBOL_AS_UID$1 ? function (it) {
	  return typeof it == 'symbol';
	} : function (it) {
	  var $Symbol = getBuiltIn$1('Symbol');
	  return isCallable$6($Symbol) && isPrototypeOf($Symbol.prototype, $Object$2(it));
	};

	var $String$2 = String;

	var tryToString$1 = function (argument) {
	  try {
	    return $String$2(argument);
	  } catch (error) {
	    return 'Object';
	  }
	};

	var isCallable$5 = isCallable$9;
	var tryToString = tryToString$1;

	var $TypeError$4 = TypeError;

	// `Assert: IsCallable(argument) is true`
	var aCallable$2 = function (argument) {
	  if (isCallable$5(argument)) return argument;
	  throw $TypeError$4(tryToString(argument) + ' is not a function');
	};

	var aCallable$1 = aCallable$2;

	// `GetMethod` abstract operation
	// https://tc39.es/ecma262/#sec-getmethod
	var getMethod$1 = function (V, P) {
	  var func = V[P];
	  return func == null ? undefined : aCallable$1(func);
	};

	var call$3 = functionCall;
	var isCallable$4 = isCallable$9;
	var isObject$4 = isObject$5;

	var $TypeError$3 = TypeError;

	// `OrdinaryToPrimitive` abstract operation
	// https://tc39.es/ecma262/#sec-ordinarytoprimitive
	var ordinaryToPrimitive$1 = function (input, pref) {
	  var fn, val;
	  if (pref === 'string' && isCallable$4(fn = input.toString) && !isObject$4(val = call$3(fn, input))) return val;
	  if (isCallable$4(fn = input.valueOf) && !isObject$4(val = call$3(fn, input))) return val;
	  if (pref !== 'string' && isCallable$4(fn = input.toString) && !isObject$4(val = call$3(fn, input))) return val;
	  throw $TypeError$3("Can't convert object to primitive value");
	};

	var shared$1 = {exports: {}};

	var global$6 = global$9;

	// eslint-disable-next-line es-x/no-object-defineproperty -- safe
	var defineProperty = Object.defineProperty;

	var defineGlobalProperty$1 = function (key, value) {
	  try {
	    defineProperty(global$6, key, { value: value, configurable: true, writable: true });
	  } catch (error) {
	    global$6[key] = value;
	  } return value;
	};

	var global$5 = global$9;
	var defineGlobalProperty = defineGlobalProperty$1;

	var SHARED = '__core-js_shared__';
	var store$1 = global$5[SHARED] || defineGlobalProperty(SHARED, {});

	var sharedStore = store$1;

	var store = sharedStore;

	(shared$1.exports = function (key, value) {
	  return store[key] || (store[key] = value !== undefined ? value : {});
	})('versions', []).push({
	  version: '3.23.4',
	  mode: 'pure' ,
	  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
	  license: 'https://github.com/zloirock/core-js/blob/v3.23.4/LICENSE',
	  source: 'https://github.com/zloirock/core-js'
	});

	var requireObjectCoercible$1 = requireObjectCoercible$3;

	var $Object$1 = Object;

	// `ToObject` abstract operation
	// https://tc39.es/ecma262/#sec-toobject
	var toObject$1 = function (argument) {
	  return $Object$1(requireObjectCoercible$1(argument));
	};

	var uncurryThis$7 = functionUncurryThis;
	var toObject = toObject$1;

	var hasOwnProperty = uncurryThis$7({}.hasOwnProperty);

	// `HasOwnProperty` abstract operation
	// https://tc39.es/ecma262/#sec-hasownproperty
	// eslint-disable-next-line es-x/no-object-hasown -- safe
	var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
	  return hasOwnProperty(toObject(it), key);
	};

	var uncurryThis$6 = functionUncurryThis;

	var id = 0;
	var postfix = Math.random();
	var toString$3 = uncurryThis$6(1.0.toString);

	var uid$1 = function (key) {
	  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
	};

	var global$4 = global$9;
	var shared = shared$1.exports;
	var hasOwn$2 = hasOwnProperty_1;
	var uid = uid$1;
	var NATIVE_SYMBOL$1 = nativeSymbol;
	var USE_SYMBOL_AS_UID = useSymbolAsUid;

	var WellKnownSymbolsStore = shared('wks');
	var Symbol$2 = global$4.Symbol;
	var symbolFor = Symbol$2 && Symbol$2['for'];
	var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$2 : Symbol$2 && Symbol$2.withoutSetter || uid;

	var wellKnownSymbol$3 = function (name) {
	  if (!hasOwn$2(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL$1 || typeof WellKnownSymbolsStore[name] == 'string')) {
	    var description = 'Symbol.' + name;
	    if (NATIVE_SYMBOL$1 && hasOwn$2(Symbol$2, name)) {
	      WellKnownSymbolsStore[name] = Symbol$2[name];
	    } else if (USE_SYMBOL_AS_UID && symbolFor) {
	      WellKnownSymbolsStore[name] = symbolFor(description);
	    } else {
	      WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
	    }
	  } return WellKnownSymbolsStore[name];
	};

	var call$2 = functionCall;
	var isObject$3 = isObject$5;
	var isSymbol$2 = isSymbol$3;
	var getMethod = getMethod$1;
	var ordinaryToPrimitive = ordinaryToPrimitive$1;
	var wellKnownSymbol$2 = wellKnownSymbol$3;

	var $TypeError$2 = TypeError;
	var TO_PRIMITIVE = wellKnownSymbol$2('toPrimitive');

	// `ToPrimitive` abstract operation
	// https://tc39.es/ecma262/#sec-toprimitive
	var toPrimitive$1 = function (input, pref) {
	  if (!isObject$3(input) || isSymbol$2(input)) return input;
	  var exoticToPrim = getMethod(input, TO_PRIMITIVE);
	  var result;
	  if (exoticToPrim) {
	    if (pref === undefined) pref = 'default';
	    result = call$2(exoticToPrim, input, pref);
	    if (!isObject$3(result) || isSymbol$2(result)) return result;
	    throw $TypeError$2("Can't convert object to primitive value");
	  }
	  if (pref === undefined) pref = 'number';
	  return ordinaryToPrimitive(input, pref);
	};

	var toPrimitive = toPrimitive$1;
	var isSymbol$1 = isSymbol$3;

	// `ToPropertyKey` abstract operation
	// https://tc39.es/ecma262/#sec-topropertykey
	var toPropertyKey$2 = function (argument) {
	  var key = toPrimitive(argument, 'string');
	  return isSymbol$1(key) ? key : key + '';
	};

	var global$3 = global$9;
	var isObject$2 = isObject$5;

	var document$1 = global$3.document;
	// typeof document.createElement is 'object' in old IE
	var EXISTS = isObject$2(document$1) && isObject$2(document$1.createElement);

	var documentCreateElement = function (it) {
	  return EXISTS ? document$1.createElement(it) : {};
	};

	var DESCRIPTORS$4 = descriptors;
	var fails$4 = fails$9;
	var createElement = documentCreateElement;

	// Thanks to IE8 for its funny defineProperty
	var ie8DomDefine = !DESCRIPTORS$4 && !fails$4(function () {
	  // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
	  return Object.defineProperty(createElement('div'), 'a', {
	    get: function () { return 7; }
	  }).a != 7;
	});

	var DESCRIPTORS$3 = descriptors;
	var call$1 = functionCall;
	var propertyIsEnumerableModule = objectPropertyIsEnumerable;
	var createPropertyDescriptor$1 = createPropertyDescriptor$2;
	var toIndexedObject = toIndexedObject$1;
	var toPropertyKey$1 = toPropertyKey$2;
	var hasOwn$1 = hasOwnProperty_1;
	var IE8_DOM_DEFINE$1 = ie8DomDefine;

	// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
	var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;

	// `Object.getOwnPropertyDescriptor` method
	// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
	objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
	  O = toIndexedObject(O);
	  P = toPropertyKey$1(P);
	  if (IE8_DOM_DEFINE$1) try {
	    return $getOwnPropertyDescriptor$1(O, P);
	  } catch (error) { /* empty */ }
	  if (hasOwn$1(O, P)) return createPropertyDescriptor$1(!call$1(propertyIsEnumerableModule.f, O, P), O[P]);
	};

	var fails$3 = fails$9;
	var isCallable$3 = isCallable$9;

	var replacement = /#|\.prototype\./;

	var isForced$1 = function (feature, detection) {
	  var value = data[normalize(feature)];
	  return value == POLYFILL ? true
	    : value == NATIVE ? false
	    : isCallable$3(detection) ? fails$3(detection)
	    : !!detection;
	};

	var normalize = isForced$1.normalize = function (string) {
	  return String(string).replace(replacement, '.').toLowerCase();
	};

	var data = isForced$1.data = {};
	var NATIVE = isForced$1.NATIVE = 'N';
	var POLYFILL = isForced$1.POLYFILL = 'P';

	var isForced_1 = isForced$1;

	var uncurryThis$5 = functionUncurryThis;
	var aCallable = aCallable$2;
	var NATIVE_BIND = functionBindNative;

	var bind$1 = uncurryThis$5(uncurryThis$5.bind);

	// optional / simple context binding
	var functionBindContext = function (fn, that) {
	  aCallable(fn);
	  return that === undefined ? fn : NATIVE_BIND ? bind$1(fn, that) : function (/* ...args */) {
	    return fn.apply(that, arguments);
	  };
	};

	var objectDefineProperty = {};

	var DESCRIPTORS$2 = descriptors;
	var fails$2 = fails$9;

	// V8 ~ Chrome 36-
	// https://bugs.chromium.org/p/v8/issues/detail?id=3334
	var v8PrototypeDefineBug = DESCRIPTORS$2 && fails$2(function () {
	  // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
	  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
	    value: 42,
	    writable: false
	  }).prototype != 42;
	});

	var isObject$1 = isObject$5;

	var $String$1 = String;
	var $TypeError$1 = TypeError;

	// `Assert: Type(argument) is Object`
	var anObject$1 = function (argument) {
	  if (isObject$1(argument)) return argument;
	  throw $TypeError$1($String$1(argument) + ' is not an object');
	};

	var DESCRIPTORS$1 = descriptors;
	var IE8_DOM_DEFINE = ie8DomDefine;
	var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
	var anObject = anObject$1;
	var toPropertyKey = toPropertyKey$2;

	var $TypeError = TypeError;
	// eslint-disable-next-line es-x/no-object-defineproperty -- safe
	var $defineProperty = Object.defineProperty;
	// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
	var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
	var ENUMERABLE = 'enumerable';
	var CONFIGURABLE = 'configurable';
	var WRITABLE = 'writable';

	// `Object.defineProperty` method
	// https://tc39.es/ecma262/#sec-object.defineproperty
	objectDefineProperty.f = DESCRIPTORS$1 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
	  anObject(O);
	  P = toPropertyKey(P);
	  anObject(Attributes);
	  if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
	    var current = $getOwnPropertyDescriptor(O, P);
	    if (current && current[WRITABLE]) {
	      O[P] = Attributes.value;
	      Attributes = {
	        configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
	        enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
	        writable: false
	      };
	    }
	  } return $defineProperty(O, P, Attributes);
	} : $defineProperty : function defineProperty(O, P, Attributes) {
	  anObject(O);
	  P = toPropertyKey(P);
	  anObject(Attributes);
	  if (IE8_DOM_DEFINE) try {
	    return $defineProperty(O, P, Attributes);
	  } catch (error) { /* empty */ }
	  if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
	  if ('value' in Attributes) O[P] = Attributes.value;
	  return O;
	};

	var DESCRIPTORS = descriptors;
	var definePropertyModule = objectDefineProperty;
	var createPropertyDescriptor = createPropertyDescriptor$2;

	var createNonEnumerableProperty$1 = DESCRIPTORS ? function (object, key, value) {
	  return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
	} : function (object, key, value) {
	  object[key] = value;
	  return object;
	};

	var global$2 = global$9;
	var apply$2 = functionApply;
	var uncurryThis$4 = functionUncurryThis;
	var isCallable$2 = isCallable$9;
	var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
	var isForced = isForced_1;
	var path$2 = path$4;
	var bind = functionBindContext;
	var createNonEnumerableProperty = createNonEnumerableProperty$1;
	var hasOwn = hasOwnProperty_1;

	var wrapConstructor = function (NativeConstructor) {
	  var Wrapper = function (a, b, c) {
	    if (this instanceof Wrapper) {
	      switch (arguments.length) {
	        case 0: return new NativeConstructor();
	        case 1: return new NativeConstructor(a);
	        case 2: return new NativeConstructor(a, b);
	      } return new NativeConstructor(a, b, c);
	    } return apply$2(NativeConstructor, this, arguments);
	  };
	  Wrapper.prototype = NativeConstructor.prototype;
	  return Wrapper;
	};

	/*
	  options.target         - name of the target object
	  options.global         - target is the global object
	  options.stat           - export as static methods of target
	  options.proto          - export as prototype methods of target
	  options.real           - real prototype method for the `pure` version
	  options.forced         - export even if the native feature is available
	  options.bind           - bind methods to the target, required for the `pure` version
	  options.wrap           - wrap constructors to preventing global pollution, required for the `pure` version
	  options.unsafe         - use the simple assignment of property instead of delete + defineProperty
	  options.sham           - add a flag to not completely full polyfills
	  options.enumerable     - export as enumerable property
	  options.dontCallGetSet - prevent calling a getter on target
	  options.name           - the .name of the function if it does not match the key
	*/
	var _export = function (options, source) {
	  var TARGET = options.target;
	  var GLOBAL = options.global;
	  var STATIC = options.stat;
	  var PROTO = options.proto;

	  var nativeSource = GLOBAL ? global$2 : STATIC ? global$2[TARGET] : (global$2[TARGET] || {}).prototype;

	  var target = GLOBAL ? path$2 : path$2[TARGET] || createNonEnumerableProperty(path$2, TARGET, {})[TARGET];
	  var targetPrototype = target.prototype;

	  var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
	  var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;

	  for (key in source) {
	    FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
	    // contains in native
	    USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);

	    targetProperty = target[key];

	    if (USE_NATIVE) if (options.dontCallGetSet) {
	      descriptor = getOwnPropertyDescriptor(nativeSource, key);
	      nativeProperty = descriptor && descriptor.value;
	    } else nativeProperty = nativeSource[key];

	    // export native or implementation
	    sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];

	    if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;

	    // bind timers to global for call from export context
	    if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global$2);
	    // wrap global constructors for prevent changs in this version
	    else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
	    // make static versions for prototype methods
	    else if (PROTO && isCallable$2(sourceProperty)) resultProperty = uncurryThis$4(sourceProperty);
	    // default case
	    else resultProperty = sourceProperty;

	    // add a flag to not completely full polyfills
	    if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
	      createNonEnumerableProperty(resultProperty, 'sham', true);
	    }

	    createNonEnumerableProperty(target, key, resultProperty);

	    if (PROTO) {
	      VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
	      if (!hasOwn(path$2, VIRTUAL_PROTOTYPE)) {
	        createNonEnumerableProperty(path$2, VIRTUAL_PROTOTYPE, {});
	      }
	      // export virtual prototype methods
	      createNonEnumerableProperty(path$2[VIRTUAL_PROTOTYPE], key, sourceProperty);
	      // export real prototype methods
	      if (options.real && targetPrototype && !targetPrototype[key]) {
	        createNonEnumerableProperty(targetPrototype, key, sourceProperty);
	      }
	    }
	  }
	};

	var classof$2 = classofRaw$1;

	// `IsArray` abstract operation
	// https://tc39.es/ecma262/#sec-isarray
	// eslint-disable-next-line es-x/no-array-isarray -- safe
	var isArray$1 = Array.isArray || function isArray(argument) {
	  return classof$2(argument) == 'Array';
	};

	var uncurryThis$3 = functionUncurryThis;

	var arraySlice$1 = uncurryThis$3([].slice);

	var $$1 = _export;
	var getBuiltIn = getBuiltIn$3;
	var apply$1 = functionApply;
	var call = functionCall;
	var uncurryThis$2 = functionUncurryThis;
	var fails$1 = fails$9;
	var isArray = isArray$1;
	var isCallable$1 = isCallable$9;
	var isObject = isObject$5;
	var isSymbol = isSymbol$3;
	var arraySlice = arraySlice$1;
	var NATIVE_SYMBOL = nativeSymbol;

	var $stringify = getBuiltIn('JSON', 'stringify');
	var exec$1 = uncurryThis$2(/./.exec);
	var charAt = uncurryThis$2(''.charAt);
	var charCodeAt = uncurryThis$2(''.charCodeAt);
	var replace$1 = uncurryThis$2(''.replace);
	var numberToString = uncurryThis$2(1.0.toString);

	var tester = /[\uD800-\uDFFF]/g;
	var low = /^[\uD800-\uDBFF]$/;
	var hi = /^[\uDC00-\uDFFF]$/;

	var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails$1(function () {
	  var symbol = getBuiltIn('Symbol')();
	  // MS Edge converts symbol values to JSON as {}
	  return $stringify([symbol]) != '[null]'
	    // WebKit converts symbol values to JSON as null
	    || $stringify({ a: symbol }) != '{}'
	    // V8 throws on boxed symbols
	    || $stringify(Object(symbol)) != '{}';
	});

	// https://github.com/tc39/proposal-well-formed-stringify
	var ILL_FORMED_UNICODE = fails$1(function () {
	  return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
	    || $stringify('\uDEAD') !== '"\\udead"';
	});

	var stringifyWithSymbolsFix = function (it, replacer) {
	  var args = arraySlice(arguments);
	  var $replacer = replacer;
	  if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
	  if (!isArray(replacer)) replacer = function (key, value) {
	    if (isCallable$1($replacer)) value = call($replacer, this, key, value);
	    if (!isSymbol(value)) return value;
	  };
	  args[1] = replacer;
	  return apply$1($stringify, null, args);
	};

	var fixIllFormed = function (match, offset, string) {
	  var prev = charAt(string, offset - 1);
	  var next = charAt(string, offset + 1);
	  if ((exec$1(low, match) && !exec$1(hi, next)) || (exec$1(hi, match) && !exec$1(low, prev))) {
	    return '\\u' + numberToString(charCodeAt(match, 0), 16);
	  } return match;
	};

	if ($stringify) {
	  // `JSON.stringify` method
	  // https://tc39.es/ecma262/#sec-json.stringify
	  $$1({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
	    // eslint-disable-next-line no-unused-vars -- required for `.length`
	    stringify: function stringify(it, replacer, space) {
	      var args = arraySlice(arguments);
	      var result = apply$1(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);
	      return ILL_FORMED_UNICODE && typeof result == 'string' ? replace$1(result, tester, fixIllFormed) : result;
	    }
	  });
	}

	var path$1 = path$4;
	var apply = functionApply;

	// eslint-disable-next-line es-x/no-json -- safe
	if (!path$1.JSON) path$1.JSON = { stringify: JSON.stringify };

	// eslint-disable-next-line no-unused-vars -- required for `.length`
	var stringify$5 = function stringify(it, replacer, space) {
	  return apply(path$1.JSON.stringify, null, arguments);
	};

	var parent$5 = stringify$5;

	var stringify$4 = parent$5;

	var parent$4 = stringify$4;

	var stringify$3 = parent$4;

	var parent$3 = stringify$3;

	var stringify$2 = parent$3;

	var stringify$1 = stringify$2;

	var stringify = stringify$1;

	var wellKnownSymbol$1 = wellKnownSymbol$3;

	var TO_STRING_TAG$1 = wellKnownSymbol$1('toStringTag');
	var test = {};

	test[TO_STRING_TAG$1] = 'z';

	var toStringTagSupport = String(test) === '[object z]';

	var TO_STRING_TAG_SUPPORT = toStringTagSupport;
	var isCallable = isCallable$9;
	var classofRaw = classofRaw$1;
	var wellKnownSymbol = wellKnownSymbol$3;

	var TO_STRING_TAG = wellKnownSymbol('toStringTag');
	var $Object = Object;

	// ES3 wrong here
	var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';

	// fallback for IE11 Script Access Denied error
	var tryGet = function (it, key) {
	  try {
	    return it[key];
	  } catch (error) { /* empty */ }
	};

	// getting tag from ES6+ `Object.prototype.toString`
	var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
	  var O, tag, result;
	  return it === undefined ? 'Undefined' : it === null ? 'Null'
	    // @@toStringTag case
	    : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
	    // builtinTag case
	    : CORRECT_ARGUMENTS ? classofRaw(O)
	    // ES3 arguments fallback
	    : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
	};

	var classof = classof$1;

	var $String = String;

	var toString$2 = function (argument) {
	  if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
	  return $String(argument);
	};

	// a string of all valid unicode whitespaces
	var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
	  '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';

	var uncurryThis$1 = functionUncurryThis;
	var requireObjectCoercible = requireObjectCoercible$3;
	var toString$1 = toString$2;
	var whitespaces$1 = whitespaces$2;

	var replace = uncurryThis$1(''.replace);
	var whitespace = '[' + whitespaces$1 + ']';
	var ltrim = RegExp('^' + whitespace + whitespace + '*');
	var rtrim = RegExp(whitespace + whitespace + '*$');

	// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
	var createMethod = function (TYPE) {
	  return function ($this) {
	    var string = toString$1(requireObjectCoercible($this));
	    if (TYPE & 1) string = replace(string, ltrim, '');
	    if (TYPE & 2) string = replace(string, rtrim, '');
	    return string;
	  };
	};

	var stringTrim = {
	  // `String.prototype.{ trimLeft, trimStart }` methods
	  // https://tc39.es/ecma262/#sec-string.prototype.trimstart
	  start: createMethod(1),
	  // `String.prototype.{ trimRight, trimEnd }` methods
	  // https://tc39.es/ecma262/#sec-string.prototype.trimend
	  end: createMethod(2),
	  // `String.prototype.trim` method
	  // https://tc39.es/ecma262/#sec-string.prototype.trim
	  trim: createMethod(3)
	};

	var global$1 = global$9;
	var fails = fails$9;
	var uncurryThis = functionUncurryThis;
	var toString = toString$2;
	var trim = stringTrim.trim;
	var whitespaces = whitespaces$2;

	var $parseInt$1 = global$1.parseInt;
	var Symbol$1 = global$1.Symbol;
	var ITERATOR = Symbol$1 && Symbol$1.iterator;
	var hex = /^[+-]?0x/i;
	var exec = uncurryThis(hex.exec);
	var FORCED = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces + '0x16') !== 22
	  // MS Edge 18- broken with boxed symbols
	  || (ITERATOR && !fails(function () { $parseInt$1(Object(ITERATOR)); }));

	// `parseInt` method
	// https://tc39.es/ecma262/#sec-parseint-string-radix
	var numberParseInt = FORCED ? function parseInt(string, radix) {
	  var S = trim(toString(string));
	  return $parseInt$1(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
	} : $parseInt$1;

	var $ = _export;
	var $parseInt = numberParseInt;

	// `parseInt` method
	// https://tc39.es/ecma262/#sec-parseint-string-radix
	$({ global: true, forced: parseInt != $parseInt }, {
	  parseInt: $parseInt
	});

	var path = path$4;

	var _parseInt$5 = path.parseInt;

	var parent$2 = _parseInt$5;

	var _parseInt$4 = parent$2;

	var parent$1 = _parseInt$4;

	var _parseInt$3 = parent$1;

	var parent = _parseInt$3;

	var _parseInt$2 = parent;

	var _parseInt$1 = _parseInt$2;

	var _parseInt = _parseInt$1;

	var _this = undefined;

	/**
	 *是否初始化过
	 */
	var isInitFlag = false;
	/**
	 *账号token失效时长
	 */

	var _expired_in = null;
	/**
	 *退出操作回调函数
	 */

	var _onQuit = null;
	/**
	 *停止的回调函数
	 */

	var _onStop = null;
	/**
	 *保持心跳得url
	 */

	var _url = null;
	/**
	 *请求头
	 */

	var _header = null;
	/**
	 *保持心跳请求方法
	 */

	var _method = null;
	/**
	 *记录当前时间
	 */

	var now_time = null;
	/**
	 *token预计过期时间
	 */

	var token_expired_time = null;
	/**
	 *下次定时任务执行时间点
	 */

	var next_task_time = null;
	/**
	 *用户最后得操作时间
	 */

	var userBehaviorStartTime = null;
	/**
	 *定时器请求对象存储
	 */

	var userBehaviorInterval = null;
	/**
	 *定时器请求对象存储
	 */

	var stopInterval = null;
	/**
	 *请求状态
	 */

	var loading = false;
	/**
	 *获取当前时间
	 * @returns int
	 */

	var _getNowTime = function _getNowTime() {
	  return new Date().getTime();
	};
	/**
	 *重新设定账号token失效时长
	 * @param {*} expired_in
	 */


	var setExpiredIn = function setExpiredIn(expired_in) {
	  _expired_in = _expired_in * 1000;
	};
	/**
	 *定时任务执行时长
	 */


	var _getTaskInterval = function _getTaskInterval() {
	  return _expired_in / 2;
	};
	/**
	 *停止心跳保活
	 */


	var stop = function stop() {
	  if (stopInterval) return false;
	  stopSetTimeout();

	  if (_onStop) {
	    _onStop();
	  }
	};

	var stopSetTimeout = function stopSetTimeout() {
	  if (stopInterval) {
	    clearTimeout(stopInterval);
	    stopInterval = null;
	  }

	  stopInterval = setTimeout(function () {
	    updateTime();
	    stopSetTimeout();
	  }, 30000);
	};
	/**
	 *重新开启心跳保活
	 */


	var restart = function restart() {
	  if (stopInterval) {
	    clearTimeout(stopInterval);
	    stopInterval = null;
	  }
	};
	/**
	 *请求接口封装
	 * @param {*} param0
	 */


	var _ajax = function _ajax(_ref) {
	  var _ref$url = _ref.url,
	      url = _ref$url === void 0 ? '' : _ref$url,
	      _ref$method = _ref.method,
	      method = _ref$method === void 0 ? 'post' : _ref$method,
	      _ref$header = _ref.header,
	      header = _ref$header === void 0 ? {
	    'Content-Type': 'application/json'
	  } : _ref$header,
	      _ref$async = _ref.async,
	      async = _ref$async === void 0 ? false : _ref$async,
	      onSuccess = _ref.onSuccess,
	      onError = _ref.onError,
	      data = _ref.data,
	      _ref$timeout = _ref.timeout,
	      timeout = _ref$timeout === void 0 ? 0 : _ref$timeout,
	      _ref$params = _ref.params,
	      params = _ref$params === void 0 ? null : _ref$params;
	  var a = new XMLHttpRequest(); // 2、设置请求路径，请求方式等

	  var _data = _JsonToString(data);

	  var _url = url + (_data ? '?' + _data : '');

	  a.open(method, _url, async); // 3、设置请求头，不然无法传递参数到后台

	  for (var h in header) {
	    a.setRequestHeader(h, header[h]);
	  } // 超时时间，单位是毫秒


	  if (async) {
	    a.timeout = timeout;
	  } // 4、绑定监听状态改变的处理函数


	  a.onreadystatechange = function () {
	    if (a.readyState === 4) {
	      if (a.status >= 200 && a.status < 300 || a.status === 304) {
	        try {
	          onSuccess(JSON.parse(a.responseText));
	        } catch (e) {
	          throw e;
	        }
	      } else {
	        if (onError) {
	          onError(JSON.parse(a.responseText));
	        }
	      }
	    }
	  };

	  if (async) {
	    a.ontimeout = function (e) {
	      // XMLHttpRequest 超时。在此做某事。
	      onError(e);
	    };
	  } // 5、发送请求并携带参数


	  try {
	    if (!params || method.toUpperCase() === 'GET') {
	      a.send();
	    } else {
	      a.send(stringify(params));
	    }
	  } catch (e) {
	    // trac-14683: Only rethrow if this hasn't been notified as an error yet
	    throw e;
	  }
	};

	var _JsonToString = function _JsonToString(json) {
	  var arr = [];

	  for (var i in json) {
	    arr.push(i + '=' + json[i]);
	  }

	  return arr.length > 1 ? arr.join('&') : null;
	};
	/**
	 *主函数判断，是否需要发送心跳请求
	 */


	var behaviorDisengagementOperation = function behaviorDisengagementOperation() {
	  var diff = userBehaviorStartTime - _getNowTime(); //计算用户最后一次操作时间与发送请求时间差


	  if (diff + _getTaskInterval() <= 0) {
	    //如果定时时间内用户都没有新的操作，就不发送请求了,只是在进行下次定时
	    var _now_time2 = _getNowTime();

	    reLoadBehaviorInterval(_now_time2);
	    return;
	  }

	  requestHeat(diff);
	};
	/**
	 *定时任务
	 * @param {*} _now_time
	 */


	var reLoadBehaviorInterval = function reLoadBehaviorInterval(_now_time) {
	  next_task_time = _now_time + _getTaskInterval(); //重新计算下次定时任务时间点

	  if (userBehaviorInterval) {
	    clearTimeout(userBehaviorInterval);
	  }

	  userBehaviorInterval = setTimeout(function () {
	    behaviorDisengagementOperation();
	  }, _getTaskInterval());
	};
	/**
	 *心跳保持
	 * @param {*} diff
	 */


	var requestHeat = function requestHeat(diff) {
	  if (!loading) {
	    loading = true;

	    if (!_header) {
	      _header = {
	        'Content-Type': 'application/json'
	      };
	    }

	    _ajax({
	      url: _url,
	      method: _method,
	      header: _header,
	      params: {
	        timediffs: _parseInt(diff / 1000)
	      },
	      onSuccess: function onSuccess(res) {
	        loading = false;

	        if (res.success) {
	          if (res.data.expired_in <= 0) {
	            //保活时间到点了，需要退出
	            if (_onQuit) {
	              _onQuit(res.error_code);
	            }
	          }

	          var _now_time3 = _getNowTime();

	          token_expired_time = _now_time3 + res.data.expired_in * 1000; //token预计过期时间

	          reLoadBehaviorInterval(_now_time3);
	        } else if (res.error_code === 100010 || res.error_code === 100011 || res.error_code === 100012 || res.error_code === 100013) {
	          //token失效，或者强登等错误提示
	          if (_onQuit) {
	            _onQuit(res.error_code);
	          }
	        } else {
	          var _now_time4 = _getNowTime();

	          reLoadBehaviorInterval(_now_time4);
	        }
	      },
	      onError: function onError() {
	        loading = false;

	        var now_time = _getNowTime();

	        reLoadBehaviorInterval(now_time);
	      }
	    });
	  }
	};
	/**
	 *更新用户操作时间
	 */


	var updateTime = function updateTime() {
	  userBehaviorStartTime = _getNowTime(); //更新用户操作时间

	  if (token_expired_time <= next_task_time) {
	    clearTimeout(userBehaviorInterval);
	    userBehaviorInterval = null;
	    requestHeat(0);
	  }
	};
	/**
	 *初始函数
	 * @param {*} param0
	 */


	var recordUserOperationBehavior = function recordUserOperationBehavior(_ref2) {
	  var expired_in = _ref2.expired_in,
	      onQuit = _ref2.onQuit,
	      onStop = _ref2.onStop,
	      header = _ref2.header,
	      url = _ref2.url,
	      method = _ref2.method;

	  //防止重复初始化
	  if (isInitFlag) {
	    return false;
	  }

	  isInitFlag = true;
	  _url = url;
	  _header = header;
	  _method = method;
	  _expired_in = expired_in * 1000;
	  _onQuit = onQuit;
	  _onStop = onStop;
	  now_time = _getNowTime();
	  token_expired_time = now_time + _expired_in; //token预计过期时间

	  next_task_time = now_time + _getTaskInterval(); // 下次定时任务时间点

	  userBehaviorStartTime = now_time; //用户最后得操作时间

	  if (!_expired_in) {
	    //用户十分钟没有操作，十分钟后退出登录页面
	    _expired_in = 1000 * 60 * 10;
	  }

	  if (!_url) {
	    _url = window.location.protocol + '//' + window.location.host + '/web/sso/keep_hearts';
	  }

	  document.addEventListener('mousemove', function () {
	    updateTime();
	  });
	  document.addEventListener('keydown', function () {
	    updateTime();
	  });
	  window.addEventListener('message', function (event) {
	    if (event.data === 'behavior:mousemove' || event.data === 'behavior:keydown') {
	      updateTime();
	    } else if (event.data === 'logout') {
	      //下面的子页面要求退出，主框架也进行退出操作
	      _onQuit && _onQuit(100013);
	    }
	  }); // 执行检测函数

	  behaviorDisengagementOperation();
	  return _this;
	};

	recordUserOperationBehavior.setExpiredIn = setExpiredIn;
	recordUserOperationBehavior.stop = stop;
	recordUserOperationBehavior.restart = restart;

	/*! *****************************************************************************
	Copyright (c) Microsoft Corporation. All rights reserved.
	Licensed under the Apache License, Version 2.0 (the "License"); you may not use
	this file except in compliance with the License. You may obtain a copy of the
	License at http://www.apache.org/licenses/LICENSE-2.0

	THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
	KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
	WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
	MERCHANTABLITY OR NON-INFRINGEMENT.

	See the Apache Version 2.0 License for specific language governing permissions
	and limitations under the License.
	***************************************************************************** */
	/* global Reflect, Promise */

	var extendStatics = function(d, b) {
	    extendStatics = Object.setPrototypeOf ||
	        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
	        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
	    return extendStatics(d, b);
	};

	function __extends(d, b) {
	    extendStatics(d, b);
	    function __() { this.constructor = d; }
	    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
	}

	function __values(o) {
	    var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
	    if (m) return m.call(o);
	    return {
	        next: function () {
	            if (o && i >= o.length) o = void 0;
	            return { value: o && o[i++], done: !o };
	        }
	    };
	}

	function __read(o, n) {
	    var m = typeof Symbol === "function" && o[Symbol.iterator];
	    if (!m) return o;
	    var i = m.call(o), r, ar = [], e;
	    try {
	        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
	    }
	    catch (error) { e = { error: error }; }
	    finally {
	        try {
	            if (r && !r.done && (m = i["return"])) m.call(i);
	        }
	        finally { if (e) throw e.error; }
	    }
	    return ar;
	}

	function __spread() {
	    for (var ar = [], i = 0; i < arguments.length; i++)
	        ar = ar.concat(__read(arguments[i]));
	    return ar;
	}

	var Event = /** @class */ (function () {
	    function Event(type, target) {
	        this.target = target;
	        this.type = type;
	    }
	    return Event;
	}());
	var ErrorEvent = /** @class */ (function (_super) {
	    __extends(ErrorEvent, _super);
	    function ErrorEvent(error, target) {
	        var _this = _super.call(this, 'error', target) || this;
	        _this.message = error.message;
	        _this.error = error;
	        return _this;
	    }
	    return ErrorEvent;
	}(Event));
	var CloseEvent = /** @class */ (function (_super) {
	    __extends(CloseEvent, _super);
	    function CloseEvent(code, reason, target) {
	        if (code === void 0) { code = 1000; }
	        if (reason === void 0) { reason = ''; }
	        var _this = _super.call(this, 'close', target) || this;
	        _this.wasClean = true;
	        _this.code = code;
	        _this.reason = reason;
	        return _this;
	    }
	    return CloseEvent;
	}(Event));

	/*!
	 * Reconnecting WebSocket
	 * by Pedro Ladaria <pedro.ladaria@gmail.com>
	 * https://github.com/pladaria/reconnecting-websocket
	 * License MIT
	 */
	var getGlobalWebSocket = function () {
	    if (typeof WebSocket !== 'undefined') {
	        // @ts-ignore
	        return WebSocket;
	    }
	};
	/**
	 * Returns true if given argument looks like a WebSocket class
	 */
	var isWebSocket = function (w) { return typeof w !== 'undefined' && !!w && w.CLOSING === 2; };
	var DEFAULT = {
	    maxReconnectionDelay: 10000,
	    minReconnectionDelay: 1000 + Math.random() * 4000,
	    minUptime: 5000,
	    reconnectionDelayGrowFactor: 1.3,
	    connectionTimeout: 4000,
	    maxRetries: Infinity,
	    maxEnqueuedMessages: Infinity,
	    startClosed: false,
	    debug: false,
	};
	var ReconnectingWebSocket = /** @class */ (function () {
	    function ReconnectingWebSocket(url, protocols, options) {
	        var _this = this;
	        if (options === void 0) { options = {}; }
	        this._listeners = {
	            error: [],
	            message: [],
	            open: [],
	            close: [],
	        };
	        this._retryCount = -1;
	        this._shouldReconnect = true;
	        this._connectLock = false;
	        this._binaryType = 'blob';
	        this._closeCalled = false;
	        this._messageQueue = [];
	        /**
	         * An event listener to be called when the WebSocket connection's readyState changes to CLOSED
	         */
	        this.onclose = null;
	        /**
	         * An event listener to be called when an error occurs
	         */
	        this.onerror = null;
	        /**
	         * An event listener to be called when a message is received from the server
	         */
	        this.onmessage = null;
	        /**
	         * An event listener to be called when the WebSocket connection's readyState changes to OPEN;
	         * this indicates that the connection is ready to send and receive data
	         */
	        this.onopen = null;
	        this._handleOpen = function (event) {
	            _this._debug('open event');
	            var _a = _this._options.minUptime, minUptime = _a === void 0 ? DEFAULT.minUptime : _a;
	            clearTimeout(_this._connectTimeout);
	            _this._uptimeTimeout = setTimeout(function () { return _this._acceptOpen(); }, minUptime);
	            _this._ws.binaryType = _this._binaryType;
	            // send enqueued messages (messages sent before websocket open event)
	            _this._messageQueue.forEach(function (message) { return _this._ws.send(message); });
	            _this._messageQueue = [];
	            if (_this.onopen) {
	                _this.onopen(event);
	            }
	            _this._listeners.open.forEach(function (listener) { return _this._callEventListener(event, listener); });
	        };
	        this._handleMessage = function (event) {
	            _this._debug('message event');
	            if (_this.onmessage) {
	                _this.onmessage(event);
	            }
	            _this._listeners.message.forEach(function (listener) { return _this._callEventListener(event, listener); });
	        };
	        this._handleError = function (event) {
	            _this._debug('error event', event.message);
	            _this._disconnect(undefined, event.message === 'TIMEOUT' ? 'timeout' : undefined);
	            if (_this.onerror) {
	                _this.onerror(event);
	            }
	            _this._debug('exec error listeners');
	            _this._listeners.error.forEach(function (listener) { return _this._callEventListener(event, listener); });
	            _this._connect();
	        };
	        this._handleClose = function (event) {
	            _this._debug('close event');
	            _this._clearTimeouts();
	            if (_this._shouldReconnect) {
	                _this._connect();
	            }
	            if (_this.onclose) {
	                _this.onclose(event);
	            }
	            _this._listeners.close.forEach(function (listener) { return _this._callEventListener(event, listener); });
	        };
	        this._url = url;
	        this._protocols = protocols;
	        this._options = options;
	        if (this._options.startClosed) {
	            this._shouldReconnect = false;
	        }
	        this._connect();
	    }
	    Object.defineProperty(ReconnectingWebSocket, "CONNECTING", {
	        get: function () {
	            return 0;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket, "OPEN", {
	        get: function () {
	            return 1;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket, "CLOSING", {
	        get: function () {
	            return 2;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket, "CLOSED", {
	        get: function () {
	            return 3;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "CONNECTING", {
	        get: function () {
	            return ReconnectingWebSocket.CONNECTING;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "OPEN", {
	        get: function () {
	            return ReconnectingWebSocket.OPEN;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "CLOSING", {
	        get: function () {
	            return ReconnectingWebSocket.CLOSING;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "CLOSED", {
	        get: function () {
	            return ReconnectingWebSocket.CLOSED;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "binaryType", {
	        get: function () {
	            return this._ws ? this._ws.binaryType : this._binaryType;
	        },
	        set: function (value) {
	            this._binaryType = value;
	            if (this._ws) {
	                this._ws.binaryType = value;
	            }
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "retryCount", {
	        /**
	         * Returns the number or connection retries
	         */
	        get: function () {
	            return Math.max(this._retryCount, 0);
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "bufferedAmount", {
	        /**
	         * The number of bytes of data that have been queued using calls to send() but not yet
	         * transmitted to the network. This value resets to zero once all queued data has been sent.
	         * This value does not reset to zero when the connection is closed; if you keep calling send(),
	         * this will continue to climb. Read only
	         */
	        get: function () {
	            var bytes = this._messageQueue.reduce(function (acc, message) {
	                if (typeof message === 'string') {
	                    acc += message.length; // not byte size
	                }
	                else if (message instanceof Blob) {
	                    acc += message.size;
	                }
	                else {
	                    acc += message.byteLength;
	                }
	                return acc;
	            }, 0);
	            return bytes + (this._ws ? this._ws.bufferedAmount : 0);
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "extensions", {
	        /**
	         * The extensions selected by the server. This is currently only the empty string or a list of
	         * extensions as negotiated by the connection
	         */
	        get: function () {
	            return this._ws ? this._ws.extensions : '';
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "protocol", {
	        /**
	         * A string indicating the name of the sub-protocol the server selected;
	         * this will be one of the strings specified in the protocols parameter when creating the
	         * WebSocket object
	         */
	        get: function () {
	            return this._ws ? this._ws.protocol : '';
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "readyState", {
	        /**
	         * The current state of the connection; this is one of the Ready state constants
	         */
	        get: function () {
	            if (this._ws) {
	                return this._ws.readyState;
	            }
	            return this._options.startClosed
	                ? ReconnectingWebSocket.CLOSED
	                : ReconnectingWebSocket.CONNECTING;
	        },
	        enumerable: true,
	        configurable: true
	    });
	    Object.defineProperty(ReconnectingWebSocket.prototype, "url", {
	        /**
	         * The URL as resolved by the constructor
	         */
	        get: function () {
	            return this._ws ? this._ws.url : '';
	        },
	        enumerable: true,
	        configurable: true
	    });
	    /**
	     * Closes the WebSocket connection or connection attempt, if any. If the connection is already
	     * CLOSED, this method does nothing
	     */
	    ReconnectingWebSocket.prototype.close = function (code, reason) {
	        if (code === void 0) { code = 1000; }
	        this._closeCalled = true;
	        this._shouldReconnect = false;
	        this._clearTimeouts();
	        if (!this._ws) {
	            this._debug('close enqueued: no ws instance');
	            return;
	        }
	        if (this._ws.readyState === this.CLOSED) {
	            this._debug('close: already closed');
	            return;
	        }
	        this._ws.close(code, reason);
	    };
	    /**
	     * Closes the WebSocket connection or connection attempt and connects again.
	     * Resets retry counter;
	     */
	    ReconnectingWebSocket.prototype.reconnect = function (code, reason) {
	        this._shouldReconnect = true;
	        this._closeCalled = false;
	        this._retryCount = -1;
	        if (!this._ws || this._ws.readyState === this.CLOSED) {
	            this._connect();
	        }
	        else {
	            this._disconnect(code, reason);
	            this._connect();
	        }
	    };
	    /**
	     * Enqueue specified data to be transmitted to the server over the WebSocket connection
	     */
	    ReconnectingWebSocket.prototype.send = function (data) {
	        if (this._ws && this._ws.readyState === this.OPEN) {
	            this._debug('send', data);
	            this._ws.send(data);
	        }
	        else {
	            var _a = this._options.maxEnqueuedMessages, maxEnqueuedMessages = _a === void 0 ? DEFAULT.maxEnqueuedMessages : _a;
	            if (this._messageQueue.length < maxEnqueuedMessages) {
	                this._debug('enqueue', data);
	                this._messageQueue.push(data);
	            }
	        }
	    };
	    /**
	     * Register an event handler of a specific event type
	     */
	    ReconnectingWebSocket.prototype.addEventListener = function (type, listener) {
	        if (this._listeners[type]) {
	            // @ts-ignore
	            this._listeners[type].push(listener);
	        }
	    };
	    ReconnectingWebSocket.prototype.dispatchEvent = function (event) {
	        var e_1, _a;
	        var listeners = this._listeners[event.type];
	        if (listeners) {
	            try {
	                for (var listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next(); !listeners_1_1.done; listeners_1_1 = listeners_1.next()) {
	                    var listener = listeners_1_1.value;
	                    this._callEventListener(event, listener);
	                }
	            }
	            catch (e_1_1) { e_1 = { error: e_1_1 }; }
	            finally {
	                try {
	                    if (listeners_1_1 && !listeners_1_1.done && (_a = listeners_1.return)) _a.call(listeners_1);
	                }
	                finally { if (e_1) throw e_1.error; }
	            }
	        }
	        return true;
	    };
	    /**
	     * Removes an event listener
	     */
	    ReconnectingWebSocket.prototype.removeEventListener = function (type, listener) {
	        if (this._listeners[type]) {
	            // @ts-ignore
	            this._listeners[type] = this._listeners[type].filter(function (l) { return l !== listener; });
	        }
	    };
	    ReconnectingWebSocket.prototype._debug = function () {
	        var args = [];
	        for (var _i = 0; _i < arguments.length; _i++) {
	            args[_i] = arguments[_i];
	        }
	        if (this._options.debug) {
	            // not using spread because compiled version uses Symbols
	            // tslint:disable-next-line
	            console.log.apply(console, __spread(['RWS>'], args));
	        }
	    };
	    ReconnectingWebSocket.prototype._getNextDelay = function () {
	        var _a = this._options, _b = _a.reconnectionDelayGrowFactor, reconnectionDelayGrowFactor = _b === void 0 ? DEFAULT.reconnectionDelayGrowFactor : _b, _c = _a.minReconnectionDelay, minReconnectionDelay = _c === void 0 ? DEFAULT.minReconnectionDelay : _c, _d = _a.maxReconnectionDelay, maxReconnectionDelay = _d === void 0 ? DEFAULT.maxReconnectionDelay : _d;
	        var delay = 0;
	        if (this._retryCount > 0) {
	            delay =
	                minReconnectionDelay * Math.pow(reconnectionDelayGrowFactor, this._retryCount - 1);
	            if (delay > maxReconnectionDelay) {
	                delay = maxReconnectionDelay;
	            }
	        }
	        this._debug('next delay', delay);
	        return delay;
	    };
	    ReconnectingWebSocket.prototype._wait = function () {
	        var _this = this;
	        return new Promise(function (resolve) {
	            setTimeout(resolve, _this._getNextDelay());
	        });
	    };
	    ReconnectingWebSocket.prototype._getNextUrl = function (urlProvider) {
	        if (typeof urlProvider === 'string') {
	            return Promise.resolve(urlProvider);
	        }
	        if (typeof urlProvider === 'function') {
	            var url = urlProvider();
	            if (typeof url === 'string') {
	                return Promise.resolve(url);
	            }
	            if (!!url.then) {
	                return url;
	            }
	        }
	        throw Error('Invalid URL');
	    };
	    ReconnectingWebSocket.prototype._connect = function () {
	        var _this = this;
	        if (this._connectLock || !this._shouldReconnect) {
	            return;
	        }
	        this._connectLock = true;
	        var _a = this._options, _b = _a.maxRetries, maxRetries = _b === void 0 ? DEFAULT.maxRetries : _b, _c = _a.connectionTimeout, connectionTimeout = _c === void 0 ? DEFAULT.connectionTimeout : _c, _d = _a.WebSocket, WebSocket = _d === void 0 ? getGlobalWebSocket() : _d;
	        if (this._retryCount >= maxRetries) {
	            this._debug('max retries reached', this._retryCount, '>=', maxRetries);
	            return;
	        }
	        this._retryCount++;
	        this._debug('connect', this._retryCount);
	        this._removeListeners();
	        if (!isWebSocket(WebSocket)) {
	            throw Error('No valid WebSocket class provided');
	        }
	        this._wait()
	            .then(function () { return _this._getNextUrl(_this._url); })
	            .then(function (url) {
	            // close could be called before creating the ws
	            if (_this._closeCalled) {
	                return;
	            }
	            _this._debug('connect', { url: url, protocols: _this._protocols });
	            _this._ws = _this._protocols
	                ? new WebSocket(url, _this._protocols)
	                : new WebSocket(url);
	            _this._ws.binaryType = _this._binaryType;
	            _this._connectLock = false;
	            _this._addListeners();
	            _this._connectTimeout = setTimeout(function () { return _this._handleTimeout(); }, connectionTimeout);
	        });
	    };
	    ReconnectingWebSocket.prototype._handleTimeout = function () {
	        this._debug('timeout event');
	        this._handleError(new ErrorEvent(Error('TIMEOUT'), this));
	    };
	    ReconnectingWebSocket.prototype._disconnect = function (code, reason) {
	        if (code === void 0) { code = 1000; }
	        this._clearTimeouts();
	        if (!this._ws) {
	            return;
	        }
	        this._removeListeners();
	        try {
	            this._ws.close(code, reason);
	            this._handleClose(new CloseEvent(code, reason, this));
	        }
	        catch (error) {
	            // ignore
	        }
	    };
	    ReconnectingWebSocket.prototype._acceptOpen = function () {
	        this._debug('accept open');
	        this._retryCount = 0;
	    };
	    ReconnectingWebSocket.prototype._callEventListener = function (event, listener) {
	        if ('handleEvent' in listener) {
	            // @ts-ignore
	            listener.handleEvent(event);
	        }
	        else {
	            // @ts-ignore
	            listener(event);
	        }
	    };
	    ReconnectingWebSocket.prototype._removeListeners = function () {
	        if (!this._ws) {
	            return;
	        }
	        this._debug('removeListeners');
	        this._ws.removeEventListener('open', this._handleOpen);
	        this._ws.removeEventListener('close', this._handleClose);
	        this._ws.removeEventListener('message', this._handleMessage);
	        // @ts-ignore
	        this._ws.removeEventListener('error', this._handleError);
	    };
	    ReconnectingWebSocket.prototype._addListeners = function () {
	        if (!this._ws) {
	            return;
	        }
	        this._debug('addListeners');
	        this._ws.addEventListener('open', this._handleOpen);
	        this._ws.addEventListener('close', this._handleClose);
	        this._ws.addEventListener('message', this._handleMessage);
	        // @ts-ignore
	        this._ws.addEventListener('error', this._handleError);
	    };
	    ReconnectingWebSocket.prototype._clearTimeouts = function () {
	        clearTimeout(this._connectTimeout);
	        clearTimeout(this._uptimeTimeout);
	    };
	    return ReconnectingWebSocket;
	}());

	var websocketConnect = function websocketConnect(_ref) {
	  var url = _ref.url,
	      config = _ref.config,
	      onOpen = _ref.onOpen,
	      onClose = _ref.onClose,
	      onMessage = _ref.onMessage,
	      onError = _ref.onError;
	  var rws = new ReconnectingWebSocket(url, [], config);
	  rws.addEventListener('open', function (e) {
	    onOpen && onOpen(e);
	  });
	  rws.addEventListener('close', function (e) {
	    onClose && onClose(e);
	  });
	  rws.addEventListener('message', function (e) {
	    onMessage && onMessage(e);
	  });
	  rws.addEventListener('error', function (e) {
	    onError && onError(e);
	  });
	  return rws;
	};

	/**
	 *拉起程序
	 * @param url
	 * @param cb
	 */

	var launchApp = function launchApp(url, cb) {
	  /* * 浏览器行为表
	     没安
	       Chrome:			cb
	       FF:				cb
	       win10-IE11:		blur->focus->blueFocusCb
	       win7-IE10:		cb
	      询问
	       Chrome:			blur->focus->blueFocusCb
	       FF:				blur->focus->blueFocusCb （询问框非模态，用户可主动触发focus，目前不能解决）
	       win10-IE11:		blur->focus->blueFocusCb
	      记住
	       Chrome:			cb
	       FF:				cb
	       win10-IE11:		cb
	       win7-IE10:		cb
	     * */
	  var isBlue = false;
	  var t = null;

	  var onBlue = function onBlue() {
	    isBlue = true;
	  }; // 0.1秒内发生了blur，则等待focus发生触发回调


	  var blueFocusCb = function blueFocusCb() {
	    if (isBlue) {
	      t && clearTimeout(t);
	      'function' == typeof cb && cb('blueFocusCb');
	    }

	    isBlue = false;
	    window.document.removeEventListener('blur', onBlue);
	    window.document.removeEventListener('focus', blueFocusCb);
	  };

	  window.document.addEventListener('blur', onBlue);
	  window.document.addEventListener('focus', blueFocusCb); // 触发打开应用

	  var iframeEl = document.createElement('iframe');
	  iframeEl.src = url;
	  iframeEl.style.display = 'none';
	  document.body.appendChild(iframeEl);
	  setTimeout(function () {
	    document.body.removeChild(iframeEl);
	  }, 100); // 0.1秒内没有发生blur（没有询问）则回未安装或已记住都会触

	  t = setTimeout(function () {
	    window.document.removeEventListener('blur', onBlue);

	    if (!isBlue) {
	      window.document.removeEventListener('focus', blueFocusCb);
	      'function' == typeof cb && cb('cb');
	    }
	  }, 100);
	};
	/**发生错误重连次数 */


	var TRY_COUNT = 1;
	/**尝试连接拉起的次数 */

	var CONNECT_COUNT = 0;
	var close_count = TRY_COUNT;
	var try_count = TRY_COUNT;
	var connect_count = CONNECT_COUNT;
	/**记录弹出框弹出的次数 */
	// let tip: null | { hide: () => void; then: (resolve: (res: boolean) => void) => Promise<void> } = null

	/**
	 *ws建链
	 * @param url
	 * @param callback
	 */

	var WebSocketStart = function WebSocketStart(url, tableUrl, callback) {
	  return websocketConnect({
	    url: url,
	    config: {
	      debug: false,
	      reconnectionDelayGrowFactor: 0,
	      connectionTimeout: 3000,
	      maxRetries: TRY_COUNT //最多连接次数

	    },
	    onOpen: function onOpen() {
	      //连接成功，重置状态
	      try_count = TRY_COUNT;
	      close_count = TRY_COUNT; // tip = null

	      connect_count = 0;
	      callback({
	        msgType: 'ws_open'
	      });
	    },
	    onError: function onError(e) {
	      console.log('-----------------onError-----------------', e); //再次尝试连接ws

	      if (try_count > 0) {
	        try_count = try_count - 1;
	      } else {
	        //ws持续连接不成功，就尝试进行拉起操作
	        //若之前没有进行拉起操作，就进行拉起操作
	        if (connect_count === 0 && tableUrl) {
	          launchApp(tableUrl, function () {
	            setTimeout(function () {
	              WebSocketStart(url, tableUrl, callback);
	            }, 3000);
	          });
	          connect_count = connect_count + 1;
	        } else {
	          //拉起也不成功，就进行错误提示
	          //延迟三秒弹出对话框，防止用户没有点击拉起程序的操作
	          callback({
	            msgType: 'ws_error'
	          });
	        }
	      }
	    },
	    onClose: function onClose(e) {
	      console.log('--------------------onClose-----------------------', e);

	      if (close_count > 0) {
	        close_count = close_count - 1;
	      } else {
	        callback({
	          msgType: 'ws_close'
	        });
	      }
	    },
	    onMessage: function onMessage(evt) {
	      //接收消息
	      var innerCodeObj = JSON.parse(evt.data);
	      callback(innerCodeObj);
	    }
	  });
	};

	var INIT_WS = false;
	var UKEY_STATUS = ['INSERT', 'LEAVE'];
	var message_type = {
	  /**报Ukey插拔事件 */
	  notify_ukey_event: 'notify_ukey_event',

	  /**获取ukey状态 */
	  notify_ukey_status: 'notify_ukey_status',

	  /**获取当前PC机上的MAC和ip列表 */
	  get_device_info_ack: 'get_device_info_ack'
	};
	var ws_type = {
	  /**websocket连接关闭 */
	  close: 'ws_close',

	  /**websocket连接成功 */
	  open: 'ws_open',

	  /**websocket连接成功 */
	  error: 'ws_error'
	};

	function ukeyReport(cert_name, cb, eventUrl) {
	  if (!eventUrl) {
	    eventUrl = '/web/portal/externals/u_key';
	  }

	  _ajax({
	    url: eventUrl,
	    method: 'post',
	    params: {
	      cert_name: cert_name,
	      ukey_event: UKEY_STATUS[1]
	    },
	    onSuccess: function onSuccess(res) {
	      'function' == typeof cb && cb('report_success');
	    },
	    onError: function onError() {
	      'function' == typeof cb && cb('report_error');
	    }
	  });
	}
	/**
	 *  检查ukey状态
	 * @param {string} url ukey建链地址，默认：ws://127.0.0.1:62131
	 * @param {string} eventUrl 事件上报url，默认：/web/portal/externals/u_key
	 * @param {string | number} systemSecurityLevel 防护密级，默认：3
	 * @param {function} onError ukey状态异常回调
	 *  onError 含有两个参数回调，第一个参数为ukey异常信息，第二个参数为上报信息
	 *  第一个参数为以下四例：
	 ```
	    {
	        "msgType":"notify_ukey_event" ,  // 状态事件类型，ukey插拔事件
	        "ukeyEvent": "LEAVE", // 固定 LEAVE
	        "certName":  "xxxxxx",  //ukey签名证书通用名
	    }
	    {
	        "msgType":"notify_ukey_status" ,  // 状态事件类型，ukey状态
	        "ukeyEvent": "LEAVE", // 固定 LEAVE
	        "certName":  "xxxxxx",  //ukey签名证书通用名
	    }
	    {
	        "msgType":"ws_error" ,  // 状态事件类型，websocket连接异常
	    }
	 ```
	 * 第二个参数为：`report_success` | `report_error` | `no_report`，分别代表 上报成功，上报失败，没有上报
	 *
	 */


	var checkUSBBehavior = function checkUSBBehavior(_ref) {
	  var _ref$url = _ref.url,
	  
	      url = _ref$url === void 0 ? 'ws://127.0.0.1:62131' : _ref$url,
	      _ref$systemSecurityLe = _ref.systemSecurityLevel,
	      systemSecurityLevel = _ref$systemSecurityLe === void 0 ? 3 : _ref$systemSecurityLe,
	      _ref$onError = _ref.onError,
	      onError = _ref$onError === void 0 ? function () {} : _ref$onError,
	      _ref$eventUrl = _ref.eventUrl,
	      eventUrl = _ref$eventUrl === void 0 ? '/web/portal/externals/u_key' : _ref$eventUrl;
	  if (!('WebSocket' in window) || INIT_WS) return;
	  if (systemSecurityLevel != 3) return;

	  try {
	    var rws = WebSocketStart(url, 'UKEYPROXY:', function (message) {
	      //事件处理
	      //ukey插拔事件上报
	      if (message.msgType === message_type.notify_ukey_event) {
	        if (message.ukeyEvent === UKEY_STATUS[1]) {
	          //拔出ukey
	          ukeyReport(message.certName, function (reportStatus) {
	            if (typeof onError === 'function') {
	              // console.log(message)
	              onError(message, reportStatus);
	            }
	          }, eventUrl);
	        }
	      } else if (message.msgType === message_type.notify_ukey_status) {
	        //ukey的连接状态
	        if (message.ukeyStatus === UKEY_STATUS[1]) {
	          //拔出ukey
	          ukeyReport(message.certName, function (reportStatus) {
	            if (typeof onError === 'function') {
	              // console.log(message)
	              onError(message, reportStatus);
	            }
	          });
	        }
	      } else if (message.msgType === ws_type.close || message.msgType === ws_type.error) {
	        //ws的连接关闭或者异常
	        if (typeof onError === 'function') {
	          // console.log(message)
	          onError(message, 'no_report');
	        }
	      } else if (message.msgType === ws_type.open) {
	        //连接上需要发送一下请求给代理程序，告诉密级情况，才会上报ukey插拔状态
	        if (!rws) return;
	        rws.send(stringify({
	          msgType: 'get_device_info',
	          systemSecurityLevel: systemSecurityLevel
	        }));
	      }
	    });
	    INIT_WS = true;
	  } catch (e) {
	    INIT_WS = false;
	    console.error(e);
	  }
	};

	var eventListen = function eventListen(_ref) {
	  var _ref$url = _ref.url,
	      url = _ref$url === void 0 ? '/web/portal/externals/behaviour' : _ref$url,
	      _ref$method = _ref.method,
	      method = _ref$method === void 0 ? 'post' : _ref$method,
	      onSend = _ref.onSend,
	      _ref$cookieKeepUrl = _ref.cookieKeepUrl,
	      cookieKeepUrl = _ref$cookieKeepUrl === void 0 ? '/web/system/connections/heartbeat' : _ref$cookieKeepUrl;
	  var _url = url; //禁止右击

	  document.body.oncontextmenu = function () {
	    return false;
	  }; //复制


	  document.body.oncopy = function (e) {
	    // return false
	    sendMessage(_url, method, '进行了复制操作。', onSend);
	  }; //复制


	  document.body.oncut = function (e) {
	    // return false
	    sendMessage(_url, method, '进行了剪切操作。', onSend);
	  };

	  document.onkeydown = function (event) {
	    if (event.ctrlKey && event.keyCode === 83) {
	      //保存html
	      sendMessage(_url, method, '进行了页面保存操作。', onSend);
	    } else if (event.ctrlKey && event.key === 'p') {
	      //打印
	      sendMessage(_url, method, '进行了页面打印操作。', onSend);
	    } else if (event.shiftKey && event.altKey && event.key === 'a') {
	      //截屏
	      sendMessage(_url, method, '进行了页面截屏操作。', onSend);
	    } else if (event.keyCode === 93) {
	      //右键菜单
	      event.preventDefault();
	    }
	  }; //截屏键只能通过keyup事件进行监听


	  document.onkeyup = function (event) {
	    if (event.keyCode === 44 || event.shiftKey && event.altKey && event.key === 'a') {
	      //截屏
	      sendMessage(_url, method, '进行了页面截屏操作。', onSend);
	    }
	  };

	  sendKeepCookie(cookieKeepUrl);
	};

	var sendMessage = function sendMessage(url, method, msg, cb) {
	  _ajax({
	    url: url,
	    method: method,
	    params: {
	      behaviour: msg
	    },
	    onSuccess: function onSuccess(res) {
	      'function' == typeof cb && cb(msg);
	    },
	    onError: function onError() {
	      'function' == typeof cb && cb(msg);
	    }
	  });
	};

	var sendKeepCookie = function sendKeepCookie(url) {
	  // let start_time = new Date().getTime()
	  // let selfTimeout = function (count) {
	  // 	if (!count) {
	  // 		count = 1
	  // 	} else {
	  // 		count = count + 1
	  // 	}
	  // 	setTimeout(function () {
	  // 		let now_time = new Date().getTime()
	  // 		if (now_time - start_time > 4010 || count > 4) {
	  // 			sendKeepCookie(url)
	  // 		} else {
	  // 			selfTimeout(count)
	  // 		}
	  // 	}, 1000)
	  // }
	  // selfTimeout(0)
	  _ajax({
	    url: url,
	    method: 'get',
	    async: true,
	    timeout: 4500,
	    header: {
	      'Content-Type': 'application/json',
	      'Mo-Action': 'AUTO',
	      'Mo-Source': 'web'
	    },
	    onSuccess: function onSuccess(res) {
	      sendKeepCookie(url);
	    },
	    onError: function onError() {
	      sendKeepCookie(url);
	    }
	  });
	};
	/*
	recordUserOperationBehavior 多少秒后页面不操作，退出
	checkUSBBehavior 
	alarmEventListen 一直在请求这个接口，涉密系统，要求关闭浏览器之后，退出登录
	*/
	var userBehavior = {
	  recordUserOperationBehavior: recordUserOperationBehavior,
	  checkUSBBehavior: checkUSBBehavior,
	  alarmEventListen: eventListen
	};

	exports.alarmEventListen = eventListen;
	exports.checkUSBBehavior = checkUSBBehavior;
	exports["default"] = userBehavior;
	exports.recordUserOperationBehavior = recordUserOperationBehavior;

	Object.defineProperty(exports, '__esModule', { value: true });

}));
